use std::error::Error;
use std::net::SocketAddr;
use tokio::net::lookup_host;

pub mod data;
pub mod provider;

pub mod visitor;
pub mod config;

pub mod app;


/// 获取ipv6地址
pub async fn get_addr_v6(domain:&str,port:u16) -> Result<SocketAddr,Box<dyn Error>>{
    lookup_host((domain, port)).await?.
        collect::<Vec<SocketAddr>>().into_iter().
        find(|x| x.is_ipv6()).
        ok_or_else(|| Box::from("未找到 IPv6 地址"))
}